package com.jhs.kjs.dto;

import org.springframework.web.multipart.MultipartFile;

public class AdminBoardPagingDTO extends AdminBoardDTO {
	private final int unit = 10;
	private int custom_unit = -1;
	
	private int start = 0;
	private int end = 0;
	private int nowSeq = 0;
	private int page = 1;
	private int totalPage = 0;
	private int seq = 0;
	private int searchType;
	private String searchName;
	private String writer;
	private String customerName;
	private String orderBy;
	private String noReViewYn;
	private String mode;
	private MultipartFile attachmentFile;
	private MultipartFile imgAttachmentFile;
	private MultipartFile update_image;
	private String attachmentPath;
	private String imgAttachmentPath;
	private int proCnt;
	public int getStart() {
		if (getPage() > 0 && start == 0) {
			return 1 + getUnit() * (getPage() - 1);
		}
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		if (getPage() > 0 && end == 0) {
			return getUnit() * getPage();
		}
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}

	public int getNowSeq() {
//		ss;
		return nowSeq;
	}

	public void setNowSeq(int nowSeq) {
		this.nowSeq = nowSeq;
		int i = 0;

		for (; getUnit() * i < nowSeq; i++) {
			page = i + 1;
		}
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getSeq() {
		return seq;
	}

	public void setSeq(int seq) {
		this.seq = seq;
	}

	public int getSearchType() {
		return searchType;
	}

	public void setSearchType(int searchType) {
		this.searchType = searchType;
	}

	public String getSearchName() {
		return searchName;
	}

	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}

	public String getWriter() {
		return writer;
	}

	public void setWriter(String writer) {
		this.writer = writer;
	}

	
	public MultipartFile getAttachmentFile() {
		return attachmentFile;
	}

	public void setAttachmentFile(MultipartFile attachmentFile) {
		this.attachmentFile = attachmentFile;
	}

	public MultipartFile getImgAttachmentFile() {
		return imgAttachmentFile;
	}

	public void setImgAttachmentFile(MultipartFile imgAttachmentFile) {
		this.imgAttachmentFile = imgAttachmentFile;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	public String getNoReViewYn() {
		return noReViewYn;
	}

	public void setNoReViewYn(String noReViewYn) {
		this.noReViewYn = noReViewYn;
	}

	public String getMode() {
		return mode;
	}

	public void setMode(String mode) {
		this.mode = mode;
	}

	public String getAttachmentPath() {
		return attachmentPath;
	}

	public void setAttachmentPath(String attachmentPath) {
		this.attachmentPath = attachmentPath;
	}

	public String getImgAttachmentPath() {
		return imgAttachmentPath;
	}

	public void setImgAttachmentPath(String imgAttachmentPath) {
		this.imgAttachmentPath = imgAttachmentPath;
	}

	public int getCustom_unit() {		
		return custom_unit;
	}

	public void setCustom_unit(int custom_unit) {
		this.custom_unit = custom_unit;
	}

	private int getUnit() {
		if(custom_unit > 0) {
			return custom_unit;
		}
		return unit;
	}

	public int getProCnt() {
		return proCnt;
	}

	public void setProCnt(int proCnt) {
		this.proCnt = proCnt;
	}

	public MultipartFile getUpdate_image() {
		return update_image;
	}

	public void setUpdate_image(MultipartFile update_image) {
		this.update_image = update_image;
	}

}
